﻿/*
Copyright 2009 Matías Fidemraizer (www.matiasfidemraizer.com).

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

using System;

namespace Comkarl.Architecture.Patterns
{
    /// <summary>
    /// Represents an exception thrown when a null pattern instance reference is provided in order to be associated to some entity.
    /// </summary>
    /// <typeparam name="TIdentifierName">
    /// The type for the pattern members identifier's name.
    /// </typeparam>
    /// <typeparam name="TPatternInstance">
    /// The type for the pattern instance.
    /// </typeparam>
    public sealed class NullAssociatedPatternInstanceException<TIdentifierName, TPatternInstance> : PatternInstanceMemberException<TIdentifierName, TPatternInstance> 
        where TIdentifierName : IEquatable<TIdentifierName> 
        where TPatternInstance : PatternInstance<TIdentifierName>
    {
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="currentInstanceMember">
        /// The instance member which have been associated with a null pattern instance.
        /// </param>
        /// <param name="innerException">
        /// A generic exception which adds more information to the main one.
        /// </param>
        public NullAssociatedPatternInstanceException(PatternInstanceMember<TIdentifierName, TPatternInstance> currentInstanceMember, Exception innerException)
            : base("NullAssociatedPatternInstance", null, currentInstanceMember, innerException)
        {
        }

        /// <summary>
        /// Hides the current instance accessor since no one is going to be associated.x
        /// </summary>
        new private string CurrentInstance;
    }
}
